package gov.pbc.nn.kjgl.archive.view;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.bstek.dorado.annotation.DataProvider;

@Component
public class FilePR {
	
	@DataProvider
	public List<Map<String, Object>> print() {
		String path = "e:/jatools/";
		List<Map<String, Object>> ls = getPath(path);
		return ls;
		}
	
	public List<Map<String, Object>> getPath(String path) {
		File f = new File(path);
		if (f != null) {
			File[] s = f.listFiles();
			List<Map<String, Object>> ls = new ArrayList<Map<String, Object>>();
			for (int i = 0; i < s.length; i++) {
				String name = s[i].getName();
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("fileName", name);
				ls.add(map);
			}
			return ls;
		}
		return null;
	}
}
